<?php

namespace mpend\modules\share\models;

use Yii;

/**
 * 资讯模型
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class DynamicView extends \common\models\dynamic\Dynamic {

    /**
     * {@inheritdoc}
     */
    public function fields() {
        return [
            'id',
            'user' => 'userCell',
            'group',
            'subject',
            'content' => function() {
                return $this->content ? $this->content->body : '';
            },
            'format' => 'formatText',
            'albums',
            'video',
            'location',
            'stats',
            'tags',
            'publishTime' => function() {
                return Yii::$app->formatter->asRelativeTime($this->updated_at);
            },
        ];
    }

}
